package com.emmmya.ocs.config.autoRunner.task;

import com.emmmya.ocs.modules.system.service.TimedTaskService;
import com.emmmya.ocs.common.base.AbstractDefaultTask;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SystemQuatrzManagementTask  extends AbstractDefaultTask {
    @Autowired
    TimedTaskService timedTaskService;

    public SystemQuatrzManagementTask(){
        this.setTaskName("启动定时任务检索");
        this.setOrder(1);
    }
    @Override
    public boolean run() {
//        TimedTask vo = new TimedTask();
//        vo.setStatus("1");
//        List<TimedTask> timedTasks = timedTaskService.getTimedTask(vo);
        try {
            timedTaskService.initSchedule();
            setMessage("启动定时任务....成功");
            return true;
        } catch (SchedulerException e) {
            e.printStackTrace();
            setMessage("启动定时任务....失败");
            return false;
        }
    }
}
